package functions.images;

import com.google.appengine.api.users.UserService;
import com.google.appengine.api.users.UserServiceFactory;

/* This class contains common HTML elements for all pages. */
public class CommonHTML {
	public enum PageName {
		upload, facebook, images, puzzles, none;
	}
	private static UserService userService = UserServiceFactory.getUserService();
	
	/* this function generates the navigation bar containing the links at the top of every page */
	public static String getNavBar(PageName page) {
		StringBuilder sb = new StringBuilder();
		sb.append("<div class='nav_bar'>" +
				"	<ul>");
		if (page == PageName.upload)
			sb.append("		<li class='currentPage'><a href='/'>Upload</a></li>");
		else
			sb.append("		<li><a href='/'>Upload</a></li>");
		if (page == PageName.facebook) 
			sb.append("		<li class='currentPage'><a href='/facebook.html'>Facebook Pictures</a></li>");
		else
			sb.append("		<li><a href='/facebook.html'>Facebook Pictures</a></li>");
		if (page == PageName.images)
			sb.append("		<li class='currentPage'><a href='/viewimages'>Saved Images</a></li>");
		else
			sb.append("		<li><a href='/viewimages'>Saved Images</a></li>");
		if (page == PageName.puzzles) 
			sb.append("		<li class='currentPage'><a href='/viewpuzzles'>Saved Puzzles</a></li>");
		else
			sb.append("		<li><a href='/viewpuzzles'>Saved Puzzles</a></li>");

		sb.append("		<li><a href='" + userService.createLogoutURL("/") + "'>Logout</a></li>" +
				"	</ul>" +
				"</div><br /><br />");
		return sb.toString();
	}

}
